<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
 </head>
 <body>
    <script>
	  function show(){
	      var r = window.prompt("请输入圆柱体的半径");
		  var h = window.prompt("请输入圆柱体的高");
		  var arr1 = area(r,h);   //调用算圆柱体面积和体积的函数
		  document.write("你输入的圆柱体的半径为："+r+";高为："+h+"<br>");
		  document.write("圆柱体的面积是:"+arr1[0]+"<br>");
		  document.write("圆柱体的体积是:"+arr1[1]+"<br>");
	      
	  }
	  function area(r,h){
		var pai = 3.14;
	    var arr2 = new Array();
		A1 = pai * r * r;    //圆柱体的上下底的面积 
        A = (A1 * 2) + ((pai * 2 * r) * h) //圆柱体的表面积
		T = A1 * h;   //圆柱体的体积
		arr2[0] = A;
		arr2[1] = T;
		return arr2;   //返回一个存储这圆柱体的面积和体积的数组
	  } 
	   show();
	</script>
 </body>
</html>
